<?php
namespace app\controllers;

use app\logic\UserLogic;
use yii;
//学生管理
class StudentController extends BackendController
{
    //管理首页
	public function actionIndex()
	{
        $query = Yii::$app->request->get('form', []);
        $page = Yii::$app->request->get('page', 1);
        $userLogic = new UserLogic();
        $this->data['breadcrumbs'] = '学生管理';
        return $this->render('index', [
            'student' => $userLogic->getAllStudent($query, $page),
            'query' => $query
        ]);
	}
    //设置密码
	public function actionSetPassword(){
        $user_id = Yii::$app->request->post('user_id');
        $username = Yii::$app->request->post('username');
        $password = Yii::$app->request->post('password');
        $userLogic = new UserLogic();
        $result = $userLogic->setPassword($user_id,$username,$password);
        echo json_encode($result);
    }

}